package com.net.service.impl;

import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Component;
import com.net.dao.CategoryDao;
import com.net.model.Category;
import com.net.service.CategoryService;
@Component("categoryService")
public class CategoryServiceImpl implements CategoryService {
	private CategoryDao categoryDao ;

	public void add(Category u) throws Exception {
		categoryDao.save(u);
	}

	public boolean delete(Category u) {
		return categoryDao.delete(u);
	}

	public List<Category> getCategories() throws Exception {
		return categoryDao.getCategories();
	}

	public boolean loadByCategoryName(String name) throws Exception {
		return categoryDao.loadCategoryByName(name);
	}

	public Category loadCategoryById(int id) {
		return categoryDao.loadCategoryById(id);
	}

	public CategoryDao getCategoryDao() {
		return categoryDao;
	}
	@Resource(name="categoryDao")
	public void setCategoryDao(CategoryDao categoryDao) {
		this.categoryDao = categoryDao;
	}

	public void update(Category category) {
		this.categoryDao.update(category);
	}

	public List<Category> searchList(String param1, String param2, String param3) {
		return categoryDao.searchList(param1, param2, param3);
	}
	
}
